package org.csu.corp.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Sign {
    private Integer id;
    private String workId;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date clockInTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date clockOutTime;
    private String clockInAddr;
    private String clockOutAddr;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getWorkId() {
        return workId;
    }

    public void setWorkId(String workId) {
        this.workId = workId;
    }

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getClockInTime() {
        return clockInTime;
    }

    public void setClockInTime(Date clockInTime) {
        this.clockInTime = clockInTime;
    }

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getClockOutTime() {
        return clockOutTime;
    }

    public void setClockOutTime(Date clockOutTime) {
        this.clockOutTime = clockOutTime;
    }

    public String getClockInAddr() {
        return clockInAddr;
    }

    public void setClockInAddr(String clockInAddr) {
        this.clockInAddr = clockInAddr;
    }

    public String getClockOutAddr() {
        return clockOutAddr;
    }

    public void setClockOutAddr(String clockOutAddr) {
        this.clockOutAddr = clockOutAddr;
    }

    @Override
    public String toString() {
        SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return "Employee{" +
                "id= " + id +
                ", workId= " + workId +
                ", clockInTime= " + formatter.format(clockInTime) +
                ", clockOutTime= " + formatter.format(clockOutTime) +
                ", clockInAddr= " + clockInAddr +
                ", clockOutAddr= " + clockOutAddr;
    }
}
